package net.yunxinyong.cec.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	//转换日期到字符串
	public static String formatDateToStr(Date date) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		return sdf.format(date);
	}
	//转换字符串成日期
	public static Date parseStrToDate(String dateStr) {
		try {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		return sdf.parse(dateStr);
		}catch(Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
